{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.3470017 ]\n",
      " [ 0.27853232]\n",
      " [-0.28134476]]\n"
     ]
    }
   ],
   "source": [
    "#输入数据\n",
    "X = np.array([[1,3,3],\n",
    "              [1,4,3],\n",
    "              [1,1,1],\n",
    "              [1,0,2]])\n",
    "#标签\n",
    "Y = np.array([[1],\n",
    "              [1],\n",
    "              [-1],\n",
    "              [-1]])\n",
    "\n",
    "#权值初始化，3行1列，取值范围-1到1\n",
    "W = (np.random.random([3,1])-0.5)*2\n",
    "\n",
    "print(W)\n",
    "#学习率设置\n",
    "lr = 0.11\n",
    "#神经网络输出\n",
    "O = 0\n",
    "\n",
    "def update():\n",
    "    global X,Y,W,lr\n",
    "    O = np.sign(np.dot(X,W)) # shape:(3,1)\n",
    "    W_C = lr*(X.T.dot(Y-O))/int(X.shape[0])\n",
    "    W = W + W_C"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.2370017 ]\n",
      " [ 0.66353232]\n",
      " [ 0.04865524]]\n",
      "0\n",
      "k= [-13.63742749]\n",
      "d= [ 4.87104148]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXkAAAEACAYAAABWLgY0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHipJREFUeJzt3XmYVNW1/vHvYrQhIKgMBhTiQMCrRgmjYzmAGuOACuIU\npxinqI9GolwHOiZRUX8xg2OCYlSwg6gENCIolCNCO10wIPTFNA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BMSTsH6c6HJhtZtVmdk7sMI30NeA9M5uYa5f92swqtrRz\n0Yq8mc02s4V1Hotyvx5VrAySLmb2FWAqcEluRJ8Y7v5xrl3TExhsZrvFztRQZnYksC73bcpI1jfw\nT+ybW3PrW4R2336xAzVCK6A/cHvu9/AP4Mov27ko3H1YsY5VJKuBHeu87pnbJkVgZq0IBf4Bd/99\n7DxN5e5/NbO5wOEkp7+9L3C0mX0LqAA6mNn97v6dyLkazN3X5H7dYGaPEdqvL8RN1WCrgJXu/kru\n9VRgixM/SrFdk5RRQTWwi5n1MrM2wGjCRWBJktRRGMC9wGJ3/0XsII1lZtuZ2da55xWECwrfipuq\n4dz9P919R3ffifD3fk6SCryZtct9C8TM2gPDgTfjpmo4d18HrDSzPrlNh/AlA4SSKPJmdqyZrQSG\nAI+b2ZOxM9XH3TcB3wdmAX8krLq5xTPcpcbMJgMvAX3M7B0zOzN2poYys32BU4CDc1PgXjOzw2Pn\naoTtgblm9gbhXMJT7v6HyJnKSTfghdw5kZeBGe4+K3KmxrqYsKrAG4TZNddvaUddDCUikmIlMZIX\nEZHmoSIvIpJiKvIiIimmIi8ikmIq8iIiKaYiLyKSYiryIiIppiIvIpJi/x//0IUnXDJLbwAAAABJ\nRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1ec03048390>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.2920017 ]\n",
      " [ 0.60853232]\n",
      " [-0.00634476]]\n",
      "1\n",
      "k= [ 95.91101709]\n",
      "d= [-46.02250176]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAEACAYAAABbMHZzAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHOhJREFUeJzt3XucVXW9//HXhxTFK6gIHCDwloJlXvGajhcQNdEemqIW\nmpiFdvSYqdDveKTOwxSPpZVZmoio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M1sh+RfjJjZ\njkAf4PW4qRrO3auAZWb2lWTXyWxh0VDQ5V/fRWSFzN03Aj8CJgNvEO5uWu8n7oXGzB4BZhFut/22\nmX0vdqbGMLNjgYuAk5LT9eaZWd/YuRqhEzDNzBYQPquY5O4TImfKig7AjOTzltnA0+4+OXKmxrqK\ncHeFBYSzfX5R34G6yEtEJIMKeuUvIiL5ofIXEckglb+ISAap/EVEMkjlLyKSQSp/EZEMUvmLiGSQ\nyl9EJIP+Pz7zn1Clsd8xAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1ec030eb630>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.3470017 ]\n",
      " [ 0.55353232]\n",
      " [-0.06134476]]\n",
      "2\n",
      "k= [ 9.02330245]\n",
      "d= [-5.65658256]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXkAAAEACAYAAABWLgY0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGptJREFUeJzt3XmUlOWVx/HvRdSgMQ6jbJERFIMaowICanApRNwyohkT\nl4MKuCSiIomYcYlRnPEkMse4TFSiERg0CiJHBBcEFApFVsUGFVwOkyaodNuuKDv0nT+e0mkNDdVd\n1fUu9fuc04eqoqrfi/b5cbnv8z6vuTsiIpJOzaIuQEREmo5CXkQkxRTyIiIpppAXEUkxhbyISIop\n5EVEUqx5Mb6JmVUCnwO1wGZ372lmLYHHgA5AJXC2u39ejOOJiEh+itXJ1wIZd+/q7j1zr10HPO/u\nBwIzgeuLdCwREclTsULetvG9zgDG5h6PBc4s0rFERCRPxQp5B2aY2SIzuyT3Wht3rwZw9yqgdZGO\nJSIieSrKTB7o5e6rzawVMN3M3iYEf13aP0FEpMSKEvLuvjr3a42ZPQn0BKrNrI27V5tZW+DDbX3W\nzBT+IiKN4O62o/cUPK4xs93M7Lu5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NDXUXYVaCCsLrm9/W9URdDiYikWCw6\neRERaRoKeRGRFFPIi4ikmEJeRCTFFPIiIimmkBcRSTGFvIhIiinkRURS7P8AOiQJEOUtAcwAAAAA\nSUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1ec02844278>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.4020017 ]\n",
      " [ 0.49853232]\n",
      " [-0.11634476]]\n",
      "3\n",
      "k= [ 4.28495723]\n",
      "d= [-3.4552626]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXMAAAEACAYAAABBDJb9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAE2VJREFUeJzt3X+Q3HV9x/HXK/JjokhMNRKG1DsFQ6gtIoPRDnZchJQE\ngQQExbFTSx2tQgTt2CGAkrPT6RTH0nGk/DC5xOBIoqIE7dgaGFwlCQmxmgaVHw4zFwnJnWfBIqPk\nArz7x3cvXi7J3X5vv7vf/X6/z8fMTXb3dvf7Jlxe99nXfr/fdUQIAFBs0/IeAADQOsIcAEqAMAeA\nEiDMAaAECHMAKAHCHABKoOkwtz3H9v22f2b7YdtXNW6faXuD7cdsf8/2jPaNCwA4FDe7n7nt2ZJm\nR8R228dI+m9JiyVdLul/I+Jztq+RNDMilrVtYgDAQZpemUfEYERsb1x+TtIjkuYoCfQ1jbutkbQk\n6yEBABNremV+wIPsXkl1SX8q6cmImDnme09HxB9lNB8AoAmp3wBtVCx3Sbq6sUIf/9uA8wMAQIcd\nkebOto9QEuRfiYh7GjcP2T4uIoYavfqvDvNYQh4ApiAiPNl90q7MV0n6eUR8Ycxt35b0N43LH5R0\nz/gHjRmosF/Lly/PfYaqzl/k2Zk//6+iz9+splfmts+U9AFJD9v+iZI65TpJN0r6uu2/lbRT0nub\n3joAIBNNh3lEbJL0ssN8+5xsxgEATAVHgDapV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mF7T9hxJ\n50lamfcsLbAKeA4q28dK+ouIWC1JEfFCRDw70WMK9x/ZYSdIenLM9V0qWJiUhe1eJavbrflOkk6j\npviJkuMw7o2IbXnPlMK/SfoHFegX0CGEpHttb7P94byHSeH1kn5te3Wj5vqS7ekTPSDzMJ/kICMg\nNdvHSLpL0tWNFXphRMRLjZpljqS32f6TvGdqhu13SxpqvDKyivNqerwzI+J0Ja8wrrT9jrwHatIR\nkk6X9O+N+X8nadlkD8hURCzI+jlz9JSk1425PqdxGzrE9hFKgvwrEXFP3vNMVUQ8a/v7khaqGB30\nmZIutH2epOmSXmn7joj465znSiUi9jT+HLZ9t5LqdGO+UzVll6QnI+JHjet3SZpwB4w8a5Yi/Kbf\nJukk2z22j5J0maQivqtf5JXVKkk/j4gv5D1IWrZfM3q+osZL5AWSHs13quZExHUR8bqIeIOSn/v7\nixbktl/eeFUn26+Q9Jea4MDGbhIRQ5KetD23cdPZmmQR0OldE5fYflLS2yX9h+3/7OT204qIFyUt\nlbRB0s8krYuICd9R7ja275S0WdJc27+0fXneMzXL9pmSPiDpXY1dy4p2zvzjJX3f9nYlXf/3IuK7\nOc9UJcdJ2th4z2KLktONbMh5pjSukvTVxs/PmyX980R35qAhACgB9mYBgBIgzAGgBAhzACgBwhwA\nSoAwB4ASIMwBoAQIcwAoAcIcAErg/wEEX44YTIVvCgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1ec03897f98>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Finished\n",
      "epoch: 3\n"
     ]
    }
   ],
   "source": [
    "for i in range(100):\n",
    "    update()#更新权值\n",
    "    print(W)#打印当前权值\n",
    "    print(i)#打印迭代次数\n",
    "    \n",
    "    # 正样本\n",
    "    x1 = [3,4]\n",
    "    y1 = [3,3]\n",
    "    #负样本\n",
    "    x2 = [1,0]\n",
    "    y2 = [1,2]\n",
    "\n",
    "    #计算分界线的斜率以及截距\n",
    "    k = -W[1]/W[2]\n",
    "    d = -W[0]/W[2]\n",
    "    print('k=',k)\n",
    "    print('d=',d)\n",
    "    xdata = (0,5)\n",
    "    plt.figure()\n",
    "    plt.plot(xdata,xdata*k+d,'r')\n",
    "    plt.scatter(x1,y1,c='b')\n",
    "    plt.scatter(x2,y2,c='y')\n",
    "    plt.show()\n",
    "    O = np.sign(np.dot(X,W))#计算当前输出  \n",
    "    if(O == Y).all(): #如果实际输出等于期望输出，模型收敛，循环结束\n",
    "        print('Finished')\n",
    "        print('epoch:',i)\n",
    "        break"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [Root]",
   "language": "python",
   "name": "Python [Root]"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
